@extends('admin.inc.base')
@section('content')
   <table class="table">
       <tr>
           <th>序号</th>
           <th>菜单名称</th>
           <th>创建时间</th>
           <th>更新时间</th>
           <th>操作</th>
       </tr>
       <?php $loop = 1;?>
       @foreach( $menus as $key => $val )
           @if($val['pid'] == 0)
               <tr>
                   <td>{{ $loop++ }}</td>
                   <td>{{ $val['title'] }}</td>
                   <td>{{ $val['created_at'] }}</td>
                   <td>{{ $val['updated_at'] }}</td>
                   <td><a href="/administrator/menu/{{ $val['id'] }}/edit">编辑</a>&nbsp;<a href="/administrator/menu/{{ $val['id'] }}/delete">删除</a></td>
               </tr>
               @if(!empty($val['sub']))
                   @foreach($val['sub'] as $sk => $sv)
                       <tr>
                           <td>{{ $loop++ }}</td>
                           <td>----{{ $sv['title'] }}</td>
                           <td>{{ $sv['created_at'] }}</td>
                           <td>{{ $sv['updated_at'] }}</td>
                           <td><a href="/administrator/menu/{{ $sv['id'] }}/edit">编辑</a>&nbsp;<a href="/administrator/menu/{{ $sv['id'] }}/delete">删除</a></td>
                       </tr>
                       @if(!empty($menus[$sv['id']]['sub']))
                           @foreach($menus[$sv['id']]['sub'] as $k => $v)
                               <tr>
                                   <td>{{ $loop++ }}</td>
                                   <td>--------{{ $v['title'] }}</td>
                                   <td>{{ $v['created_at'] }}</td>
                                   <td>{{ $v['updated_at'] }}</td>
                                   <td><a href="/administrator/menu/{{ $v['id'] }}/edit">编辑</a>&nbsp;<a href="/administrator/menu/{{ $v['id'] }}/delete">删除</a></td>
                               </tr>
                           @endforeach
                       @endif
                   @endforeach
               @endif
           @endif
       @endforeach
   </table>

@endsection